﻿using HR60_PanelSoft.Model;
using HR60_PanelSoft.Model.BaseModel;
using HR60_PanelSoft.NetWork.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HR60_PanelSoft.NetWork.Sender
{
    class Sender_010A : BaseSender
    {

        public Sender_010A(byte panelNo, Panel panel)
        {

            byte[] data = new byte[5];

            {
                if (panel.signal == null)
                {
                    data[0] = 0;
                }else
                if (panel.signal.sconst == SignalConst.NULL)
                {
                    data[0] = 0;
                }
                else if (panel.signal.sconst == SignalConst.OPEN)
                {
                    data[0] = 1;
                }
                else if (panel.signal.sconst == SignalConst.CLOSE)
                {
                    data[0] = 2;
                }

            }
            {
                if (panel.signal != null)
                data[1] = (byte)panel.signal.delay;

            }

            {
                if (panel.signal != null)
                data[2] = (byte)panel.signal.brightness;

            }

            {
                if (panel.signal != null)
                data[3] = (byte)Scene.findSceneNum(panel.signal.scene);

            }

            {
                if (panel.style == UIStyle.NULL)
                {

                    data[4] = 0;
                }
                else if (panel.style == UIStyle.QingShuang)
                {

                    data[4] = 2;
                }
                else if (panel.style == UIStyle.SheHua)
                {
                    data[4] = 1;
                }

                this.package = Package.getPackage(0x01, 0x0A, panelNo, 0x01, data);
            }
        }
    }
}
